package com.kuaiyin.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;

import java.io.Serial;
import java.io.Serializable;


@Data
@Schema(name = "EnvironmentDTO", description = "环境变量传输对象")
public class EnvironmentDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "环境变量ID(更新时必填，创建时无需填)")
    private Long id;

    @Schema(description = "变量名（唯一，如base_url）")
    @NotBlank(message = "变量名不能为空")
    @Pattern(regexp = "^[a-zA-Z_]+$", message = "变量名只允许大小写字母和下划线")
    @Size(max = 64, message = "变量名长度不能超过64字符")
    private String varName;

    @Schema(description = "变量值")
    @NotBlank(message = "变量值不能为空")
    private String varValue;

    @Schema(description = "关联的环境类型")
    private String environmentType; // DEV, TEST, STAGING, PROD

    @Schema(description = "变量类型", allowableValues = {"STRING", "NUMBER", "BOOLEAN", "JSON", "SECRET"})
    private String varType;

    @Schema(description = "是否加密（0-明文，1-加密）")
    private Boolean isEncrypted;

    @Schema(description = "变量说明")
    @Size(max = 255, message = "说明长度不能超过255字符")
    private String description;
}
